/**
 * Created by jondai on 2018/3/17.
 */

$(function () {
    //所有业务中的empCode鼠标离开时，像后端获取empName
    $("#empCode").blur(function(){
        var empCode = $("#empCode").val();
        $.ajax({
            type: "get",
            url: Feng.ctxPath + "/employee/detailByCode/"+empCode,
            dataType: "json",
            success: function(data) {
                // if(data.data){
                $("#empName").val(data.empName);
                // }
            }
        });
    })

});


function compareDays(strDateStart,strDateEnd){
    var strSeparator = "-"; //日期分隔符
    var oDate1;
    var oDate2;
    var iDays;
    oDate1= strDateStart.split(strSeparator);
    oDate2= strDateEnd.split(strSeparator);
    var strDateS = new Date(oDate1[0], oDate1[1]-1, oDate1[2]);
    var strDateE = new Date(oDate2[0], oDate2[1]-1, oDate2[2]);
    iDays = parseInt(Math.abs(strDateS - strDateE ) / 1000 / 60 / 60 /24)//把相差的毫秒数转换为天数
    return iDays ;
}